In a relational database management system a database query is usually broken down into a set of steps used to access the database information, also referred to as an access plan. For example, the following query:
SELECT *FROM Company.Employee AS e  INNER JOIN Person.Contact AS c  ON e.ContactID = c.ContactIDORDER BY c.LastNamemay be broken down into an access plan as shown in the following textual access plan:
Sort(ORDER BY:([c].[LastName] ASC))Nested Loops(Inner Join, OUTER REFERENCES:([e].[ContactID], [Expr1004])WITH UNORDERED PREFETCH)Clustered Index Scan(OBJECT:([AdventureWorks].[Company].[Employee].[PK_Employee_EmployeeID] AS [e]))Clustered IndexSeek(OBJECT:([AdventureWorks].[Person].[Contact].-[PK_Contact_ContactID] AS [c]),SEEK:([c].[ContactID]=[AdventureWorks].[Company].[Employee].[ContactID] as [e].[ContactID]) ORDEREDFORWARD)
A number of alternate ways to execute a given database query exist, each of these having widely varying performance. Thus, in order to increase the speed of database queries, typically a database query optimiser is employed. A query optimiser will select from the set of possible access plans, a access plan it deems to be most efficient according to a given criteria. As the task of generating a set of access plans and selecting the optimal access plan is a computationally expensive process, the optimal access plan is typically cached for future use. In this manner, when a database management system receives a query for which an access plan has already been computed, an access plan from cache may be retrieved and used instead. Using this method, the database query will typically take a long time to execute on its first iteration when compared to subsequent iterations.
A number of disadvantages are associated with existing approaches. For example, underlying data relating to the access plan may have changed, thereby rendering the access plan obsolete. Further, access plans may not be persistent across database management system instances. Therefore, every time the database management system is loaded the access plans will have to be regenerated resulting in a lower performance.
Therefore, there exists a need for a database management system that ameliorates one or more of the above mentioned disadvantages.